<script setup lang="ts">
import Show from "@/components/common/Show.vue";
import { ref } from "vue";
let isShow = ref(false);
let content = ref("内容");
</script>

<template>
  <div style="position: relative; display: flex; justify-content: center">
    <Show
      style="
        position: absolute;
        bottom: 36px;
        left: 50%;
        transform: translateX(-50%);
      "
    >
      <div v-show="isShow" class="tooltip">
        <span>哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈</span>
      </div>
    </Show>

    <div @mouseenter="isShow = true" @mouseleave="isShow = false">
      <slot>默认</slot>
    </div>
  </div>
</template>

<style scoped>
.tooltip {
  background: #303133;
  border-radius: 4px;
  padding: 6px 12px;
  width: fit-content;
  min-width: 80px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  line-height: normal;
  color: #fff;
  position: relative;
  &:after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #303133;
    margin-left: -10px;
  }
}
</style>
